package com.metronoteapp.until;

import android.app.Activity;
import android.content.Context;
import android.graphics.drawable.Drawable;

public class GlobalVariable
{	
	//public static int CURRENT_TAB		= 0;
	//	public static int TAB_RETAILER 	= 1;
	//	public static int TAB_SETTING		= 2;
	//	public static int TAB_DASHBOARD 	= 3;
	//	public static int TAB_REPORT		= 4;


	public static int CURRENT_TAB				= 0;
	public static int TAB_ALL_NOTE	 			= 1;
	public static int TAB_ALL_NOTE_GROUP 		= 2;
	

	



	public static int DISPLAY_WIDTH = 0;



	public static void setCurrentTab(int tab)
	{
		CURRENT_TAB = tab;
	}

	public static int getCurrentTab()
	{
		return CURRENT_TAB;
	}

	public static String[] MONTH = new String[] { "",
		"January ", "February ", "March ", "April ", "May ", "June ", "July ", "August ", "September ", "October ", "November ", "December "
	};

	private static String ERROR_MESSAGE = "";
	public static void setErrorMessage(String message)
	{
		ERROR_MESSAGE = message;
	}

	public static String getErrorMessage()
	{
		return ERROR_MESSAGE;
	}

	private static boolean ALERT_NETWORK = false;
	public static void setShowAlertNetwork(boolean value)
	{
		ALERT_NETWORK = value;
	}

	public static boolean getShowAlertNetwork()
	{
		return ALERT_NETWORK;
	}

	private static String EMAIL = "";
	public static void setEmail(String _email)
	{
		EMAIL = _email;
	}

	public static String getEmail()
	{
		return EMAIL;
	}

	private static String PARENT_ID = "";	
	public static void setParentId(String _parentId)
	{
		PARENT_ID = _parentId;
	}

	public static String getParentId()
	{
		return PARENT_ID;
	}

	private static Context TABCONTEXT 	= null;
	private static Activity TABACTIVITY = null;

	public static void setTabActivity(Activity _activity)
	{
		TABACTIVITY = _activity;
	}

	public static Activity getTabActivity()
	{
		return TABACTIVITY;
	}

	public static void setTabContext(Context _context)
	{
		TABCONTEXT = _context;
	}

	public static Context getTabContext()
	{
		return TABCONTEXT;
	}

	public static Drawable GetDrawable(Context mContext, String filename)
	{
		try
		{
			int flagID = mContext.getResources().getIdentifier("drawable/" + filename, null, mContext.getPackageName());
			return mContext.getResources().getDrawable(flagID);
		}
		catch(Exception ex)
		{
			return null;
		}
	}

	public static String CalculatorFileSize(String size)
	{
		long value = Long.valueOf(size);
		if(value < 1024)
		{
			return String.valueOf(value) + "byte modified ";
		}
		else if(value > 1024 && value < (1024*1024))
		{
			value = value/1024;
			return String.valueOf(value) + "KB modified ";
		}
		else if(value > (1024*1024) && value < (1024*1024*1024))
		{
			value = value/1024/1024;
			return String.valueOf(value) + "MB modified ";
		}
		else if(value > (1024*1024*1024))
		{
			value = value/1024/1024/1024;
			return String.valueOf(value) + "GB modified ";
		}
		return String.valueOf(value);
	}

	public static String[] VietnameseSigns = new String[] {

		"aAeEoOuUiIdDyY",

		"ﾃ｡ﾃ�ｺ｡蘯｣ﾃ｣ﾃ｢蘯･蘯ｧ蘯ｭ蘯ｩ蘯ｫﾄ�ｺｯ蘯ｱ蘯ｷ蘯ｳ蘯ｵ",

		"ﾃ?ﾃ�ｺ�ｺ｢ﾃεゃｺ､蘯ｦ蘯ｬ蘯ｨ蘯ｪﾄゃｺｮ蘯ｰ蘯ｶ蘯ｲ蘯ｴ",

		"ﾃｩﾃｨ蘯ｹ蘯ｻ蘯ｽﾃｪ蘯ｿ盻?盻�ｻ�ｻ�",

		"ﾃ嘉違ｺｸ蘯ｺ蘯ｼﾃ眼ｺｾ盻�ｻ�ｻゃｻ�",

		"ﾃｳﾃｲ盻?盻?ﾃｵﾃｴ盻黛ｻ乍ｻ吼ｻ甫ｻ糧｡盻帋ｻ?盻｣盻溂ｻ｡",

		"ﾃ禿低ｻ吾ｻ偲陛批ｻ?盻低ｻ倔ｻ批ｻ免�ｻ壯ｻ憮ｻ｢盻榱ｻ�",

		"ﾃｺﾃｹ盻･盻ｧﾅｩﾆｰ盻ｩ盻ｫ盻ｱ盻ｭ盻ｯ",

		"ﾃ堙吼ｻ､盻ｦﾅｨﾆｯ盻ｨ盻ｪ盻ｰ盻ｬ盻ｮ",

		"ﾃｭﾃｬ盻吟ｻ夏ｩ",

		"ﾃ?ﾃ吾ｻ眼ｻ案ｨ",

		"ﾄ�",

		"ﾄ?",

		"ﾃｽ盻ｳ盻ｵ盻ｷ盻ｹ",

		"ﾃ?盻ｲ盻ｴ盻ｶ盻ｸ"

	};

	public static String RemoveSign4VietnameseString(String str)
	{
		// Ti蘯ｿn hﾃ�h thay th蘯ｿ , l盻?c b盻? d蘯･u cho chu盻擁

		for (int i = 1; i < VietnameseSigns.length; i++) {
			for (int j = 0; j < VietnameseSigns[i].length(); j++) {
				str = str.replace(VietnameseSigns[i].charAt(j),
						VietnameseSigns[0].charAt(i - 1));
			}
		}
		return str;
	}


	public static int DATALIST_TB_INDEX = 0;	
	public static int DATALIST_TN_INDEX = 0;
	public static int DATALIST_MOVE_INDEX = 0;
	public static boolean ADD_FOLDER = false;

	public static void ClearData()
	{
		DATALIST_TB_INDEX = 0;
		DATALIST_TN_INDEX = 0;
		ADD_FOLDER = false;
	}
}